<? include block('htmla') ?>

<? startScript('jquery, jquery.listdnd'); ?><script type="text/javascript">

jQuery(function($){
	$("#struct ul").listDnD({
	    onDragClass: "dragging",
	    onDrop: function(list, li) {
			$.post("sort-manual/", {order:$(list).listDnDSerialize(), parent:list.id.substr(1)});
	    },
		dragHandle: "> li > div.buttonbar > div.dragHandle"
	});

	$("#struct a.button").click(function() {
		var self = $(this), href = self.attr("href"), parent = self.closest(".object"), id = parent.attr("id").substr(4);
		var title = self.attr("title").match(/(«.*»)/)[0], attr = parent.find("input.attr");

		if (self.hasClass('visible')) {
			$.post(href);
			self.removeClass('visible').addClass('hidden').attr("title", "Enable " + title).attr("href", href.replace("hide", "show"));
			attr.val(attr.val() & !1);
			return false;
		} else

		if (self.hasClass('hidden')) {
			$.post(href);
			self.removeClass('hidden').addClass('visible').attr("title", "Disable " + title).attr("href", href.replace("show", "hide"));
			attr.val(attr.val() | 1);
			return false;
		} else

		if (self.hasClass('kill')) {
			if (confirm('Are you sure you want to kill ' + title + '?')) {
				$.post(href);
				parent.remove();
			}
			return false;
		}

		return true;
	});
});

</script><? endScript(); ?>

	<fieldset><legend>=</legend><div>
	
	<? include block('adm_struct'); ?>
	
	</div></fieldset>
	
<? include block('_htmla');